package cn.ydxiaoshaui.aip.imageclassify.bean;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

import java.io.Serializable;
import java.util.List;

/**
 * @Description LOGO商标识别
 * @author 小帅丶
 * @className LogoDetect
 * @Date 2019/9/26
 **/
public class LogoDetect implements Serializable {
    private static final long serialVersionUID = 1L;
    /** 唯一的log id，用于问题定位 */
    private Long log_id;
    /** 返回结果数目，及result数组中的元素个数 */
    private Integer result_num;
    /** 标签结果数组 */
    private List<Result> result;

    public Long getLog_id() {
        return log_id;
    }

    public void setLog_id(Long log_id) {
        this.log_id = log_id;
    }

    public Integer getResult_num() {
        return result_num;
    }

    public void setResult_num(Integer result_num) {
        this.result_num = result_num;
    }

    public List<Result> getResult() {
        return result;
    }

    public void setResult(List<Result> result) {
        this.result = result;
    }

    private static class Result{
        /** 分类结果置信度（0--1.0） */
        private Double probability;
        /** 识别的品牌名称 */
        private String name;
        /** 位置信息（左起像素位置、上起像素位置、像素宽、像素高） */
        private Location location;
        /** type=0为1千种高优商标识别结果;type=1为2万类logo库的结果；其它type为自定义logo库结果 */
        private Integer type;

        public Double getProbability() {
            return probability;
        }

        public void setProbability(Double probability) {
            this.probability = probability;
        }

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public Location getLocation() {
            return location;
        }

        public void setLocation(Location location) {
            this.location = location;
        }

        public Integer getType() {
            return type;
        }

        public void setType(Integer type) {
            this.type = type;
        }
    }
    private static class Location{
        /** 左起像素位置 */
        private Integer left;
        /** 上起像素位置 */
        private Integer top;
        /** 像素宽 */
        private Integer width;
        /** 像素高 */
        private Integer height;

        public Integer getLeft() {
            return left;
        }

        public void setLeft(Integer left) {
            this.left = left;
        }

        public Integer getTop() {
            return top;
        }

        public void setTop(Integer top) {
            this.top = top;
        }

        public Integer getWidth() {
            return width;
        }

        public void setWidth(Integer width) {
            this.width = width;
        }

        public Integer getHeight() {
            return height;
        }

        public void setHeight(Integer height) {
            this.height = height;
        }
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this, new SerializerFeature[] {
                SerializerFeature.WriteMapNullValue,
                SerializerFeature.WriteNullListAsEmpty,
                SerializerFeature.WriteNullStringAsEmpty,
                SerializerFeature.WriteNullNumberAsZero,
                SerializerFeature.WriteNullBooleanAsFalse,
                SerializerFeature.UseISO8601DateFormat });
    }
}
